Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@toml-tools/parser
Advanced tools
A Toml Parser implemented in JavaScript using the Chevrotain Parsing Toolkit. This parser outputs a Chevrotain Concrete Syntax Tree Which is a low level data structure that represents the whole syntax tree.
This means that this parser could be re-used to construct many different kinds of Toml related tooling:
yarn add @toml-tools/parser
# or if you prefer npm
npm install @toml-tools/parser
This package's APIs are exported as a TypeScript definition file.
const {
parse,
BaseTomCstVisitor,
BaseTomlCstVisitorWithDefaults,
} = require("@toml-tools/parser");
const input = `
# This is a TOML document.
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
`;
const tomlCst = parse(input);
// Read the manual for using the Chevrotain CST visitor:
// - https://sap.github.io/chevrotain/docs/guide/concrete_syntax_tree.html#cst-visitor
// - The full APIs for the CST visitor are defined in api.d.ts linked above
class KeyNamesCollector extends BaseTomlCstVisitorWithDefaults {
constructor() {
super();
this.tableKeyNames = [];
}
stdTable(ctx) {
this.tableKeyNames.push(this.visit(ctx.key));
}
key(ctx) {
const keyImages = ctx.IKey.map((keyTok) => keyTok.image);
const newKey = keyImages.join(".");
return newKey;
}
}
const myVisitor = new KeyNamesCollector();
myVisitor.visit(cst);
console.log(myVisitor.tableKeyNames.length); // 1
console.log(myVisitor.tableKeyNames[0]); // "database"
FAQs
TOML Parser Implemented in JavaScript
The npm package @toml-tools/parser receives a total of 3,145 weekly downloads. As such, @toml-tools/parser popularity was classified as popular.
We found that @toml-tools/parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.